<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    thead {
      background-color: aqua;
    }

    tbody tr {
      background-color: olivedrab;
    }
  </style>
  <script>
    var showObj;
    window.onload = function () {
      showObj = document.getElementById("lb");
    }

    function show(showId) {
      showObj.style.backgroundColor = "olivedrab";
      var clObj = document.getElementById(showId);
      clObj.style.backgroundColor = "white";
      showObj = clObj;
    }
  </script>
</head>
<body>
<div>
  <table>
    <thead>
    <tr>
      <th>id</th>
      <th>姓名</th>
      <th>性别</th>
      <th>年龄</th>
      <th>职位</th>
      <th>学历</th>
    </tr>
    </thead>
    <tbody>
    <tr id="zy" onclick="show('zy')">
      <td>1</td>
      <td>赵云</td>
      <td>男</td>
      <td>21</td>
      <td>部门经理</td>
      <td>本科</td>
    </tr>
    <tr id="lb" onclick="show('lb')" style="background-color: white">
      <td>1</td>
      <td>吕布</td>
      <td>男</td>
      <td>21</td>
      <td>部门经理</td>
      <td>本科</td>
    </tr>
    <tr id="gj" onclick="show('gj')">
      <td>1</td>
      <td>郭嘉</td>
      <td>男</td>
      <td>21</td>
      <td>部门经理</td>
      <td>本科</td>
    </tr>
    </tbody>
  </table>
</div>
</body>
</html>